package com.neuedu.weishi.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Repository;

import com.neuedu.weishi.entity.VideoViewRecord;
import com.neuedu.weishi.mapper.VideoViewRecordMapper;
import com.neuedu.weishi.service.IVideoViewRecordService;

import java.util.List;

@Service("videoViewRecordService")
public class VideoViewRecordServiceImpl implements IVideoViewRecordService {

    @Autowired
    @Qualifier("videoViewRecordMapper")
    private VideoViewRecordMapper videoViewRecordMapper;

    @Override
    public List<VideoViewRecord> selectList(VideoViewRecord videoViewRecord){
        QueryWrapper<VideoViewRecord> queryWrapper = new QueryWrapper<>();
        return videoViewRecordMapper.selectList(queryWrapper);
    }

    @Override
    public IPage<VideoViewRecord> selectPage(IPage<VideoViewRecord> page){
        QueryWrapper<VideoViewRecord> queryWrapper = new QueryWrapper<>();
        return videoViewRecordMapper.selectPage(page, queryWrapper);
    }

    @Override
    public VideoViewRecord selectById(Integer viewRecordId) {
        return videoViewRecordMapper.selectById(viewRecordId);
    }

    @Override
    public int deleteById(Integer viewRecordId) {
        return videoViewRecordMapper.deleteById(viewRecordId);
    }

    @Override
    public int delete(VideoViewRecord videoViewRecord){
        QueryWrapper<VideoViewRecord> queryWrapper = new QueryWrapper<>();
        return videoViewRecordMapper.delete(queryWrapper);
    }

    @Override
    public int insert(VideoViewRecord videoViewRecord) {
        return videoViewRecordMapper.insert( videoViewRecord);
    }

    @Override
    public int updateById(VideoViewRecord videoViewRecord) {
        return videoViewRecordMapper.updateById(videoViewRecord);
    }

    @Override
    public int update(VideoViewRecord videoViewRecord) {
        UpdateWrapper<VideoViewRecord> updateWrapper = new UpdateWrapper<>();
        return videoViewRecordMapper.update(videoViewRecord,updateWrapper);
    }
}